<template>
	<view class="themeItem">
		<navigator :url="'/pages/classlist/classlist?classid='+item._id+'&name='+item.name" class="box" v-if="!isMore" >
			<image class="pic" :src="item.picurl" mode="aspectFill"></image>
			<view class="mask">{{ item.name }}</view>
			<view class="tab">{{formatTimeDifference(item.updateTime)}}前更新</view>
		</navigator>
		<!-- 如果要跳转的页面是tabber的页面，要加上opentype 如果要可以返回的话 switchTab 不想要返回的话 relaunch -->
		<navigator url="/pages/classify/classify" open-type="reLaunch" class="box more" v-else>
			<image class="pic" src="@/common/images/more.jpg" mode="aspectFill"></image>
			<view class="mask">
				<uni-icons type="more-filled" size="34" color="#fff"></uni-icons>
				<view class="text">更多</view>
			</view>
		</navigator>
	</view>
</template>

<script setup>
	import { formatTimeDifference } from '@/utils/common.js';
//定义组件props
defineProps({
	isMore:{
		type:Boolean,
		default:false
	},
	item:{
		type:Object,
		default(){
			return {
				name : '默认名称',
				picurl: '@/common/images/classify1.jpg',
				updateTime:Date.now() - 1000*60*60*5
			}
		}
	}
})
</script>

<style lang="scss" scoped>
.themeItem{
	padding: 10rpx;
	.box{
		height: 340rpx;
		overflow: hidden;
		box-sizing: border-box;
		border-radius: 10rpx;
		position: relative;
		.pic{
			width: 100%;
			height: 100%;
			border-radius: 10rpx;
			
		}
		.mask{
			width: 100%;
			position: absolute;
			bottom: 0;
			left: 0;
			background: rgba(0,0,0,0.2);
			color: #fff;
			display: flex;
			align-items: center;
			justify-content: center;
			backdrop-filter: blur(20rpx); //增加模糊滤镜
			font-weight: 600; //设置字体粗度
			font-size:30rpx; //设置字体大小
		}
		.tab{
			position: absolute;
			top:0;
			left: 0;
			background: rgba(250, 129, 90, 0.7);		
			backdrop-filter: blur(20rpx) ;
			color: #fff;
			font-size:22rpx;
			padding:6rpx 10rpx;
			border-radius: 0 0 10rpx 0;
			font-weight: 600;
		}
	}
	.box.more{  //两个类都是都有的样式
		.mask{
			width: 100%;
			height: 100%;
			flex-direction: column;
		}
		.text{
			font-size: 40rpx;
		}
	}
}
</style>